#! /usr/bin/env python
# -*- coding: utf-8 -*-

# *************************************************************
#     Filename @  permutations.py
#       Author @  Huoty
#  Create date @  2015-10-22 10:28:57
#  Description @  
# *************************************************************



# Script starts from here

def permutations(li):
    if len(li) == 0:
        yield li
    else:
        for i in range(len(li)):
            li[0], li[i] = li[i], li[0]
            for item in permutations(li[1:]):
                yield [li[0]] + item

for item in permutations(range(3)):
    print item



